import NftEggsStore from "../contracts/NftEggsStore.cdc"

// 这个脚本返回某个指定的钱包地址其NFT在市场上架的列表信息

pub fun main(account: Address, listingResourceID: UInt64): NftEggsStore.ListingDetails {
    let storefrontRef = getAccount(account)
        .getCapability<&NftEggsStore.Storefront{NftEggsStore.StorefrontPublic}>(
            NftEggsStore.StorefrontPublicPath
        )
        .borrow()
        ?? panic("Could not borrow public storefront from address")

    let listing = storefrontRef.borrowListing(listingResourceID: listingResourceID)
        ?? panic("No item with that ID")
    
    return listing.getDetails()
}
